#region Copyright Notice
// 
// 
//  
//  Copyright (c) 2009-2011 Anindya Chatterjee
//  
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//  
//      http://www.apache.org/licenses/LICENSE-2.0
//  
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
// 
// 
#endregion
namespace AbstractClass.Runtime.Caching
{
    /// <summary>
    /// Defines methods to handle the eviction policy of a <see cref="Cache&lt;TKey, TValue&gt;"/>.
    /// </summary>
    /// <typeparam name="TKey">The type of the keys in the cache.</typeparam>
    public interface IEvictionPolicy<TKey>
    {
        /// <summary>
        /// Returns the key associated with the evicted entry.
        /// </summary>
        /// <returns>The key associated with the evicted entry.</returns>
        TKey GetVictimEntry();

        /// <summary>
        /// Registers usage of the specified key in the internal usage data store of the policy.
        /// </summary>
        /// <param name="key">The key to register.</param>
        void RegisterKey(TKey key);

        /// <summary>
        /// Revokes the data associated with the specified key from the 
        /// internal usage data store of the policy.
        /// </summary>
        /// <param name="key">The key to revoke.</param>
        void Revoke(TKey key);

        /// <summary>
        /// Renews the policy by clearing all key usage data.
        /// </summary>
        void Renew();
    }
}